package com.jch.mp.manner1.server;

import com.alibaba.fastjson.JSON;
import com.jch.mp.manner1.domain.message.GroupMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.text.SimpleDateFormat;
import java.util.Date;

public class GroupMessageHandler extends SimpleChannelInboundHandler<GroupMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, GroupMessage msg) throws Exception {
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()) + " 收到消息: " + JSON.toJSONString(msg));
        ctx.writeAndFlush(new GroupMessage(2, "服务器发送Group测试", "测试测试"));
    }
}
